package tron.kafka;

import org.springframework.context.annotation.Conditional;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

@Service
@Conditional(KafkaCondition.class)
public class KafkaReceivedServer {

    //在配置文件中需要指定consumer分组id
    @KafkaListener(topics = "topic1",groupId = "group001")
    public void onMeg(String msg) {
        System.out.println("kafka group001 topic1 监听到消息："+msg);
    }

    @KafkaListener(topics = "topic2",groupId = "group002")
    public void OnMessage(String msg) {
        System.out.println("kafka group002 topic2 接收到消息： "+msg);
    }
}
